package com.hsp.enum_;

public class Enumeration01 {
    public static void main(String[] args) {
        System.out.println(Season01.SPRING);
        System.out.println(Season01.SUMMER);
        System.out.println(Season01.AUTUMN);
        System.out.println(Season01.WINTER);
    }
}

//使用关键字enum来替代class
//原先
//    public static final Season01 SPRING = new Season01("春天", "温暖");
//    WINTER("冬天", "寒冷");
//常量对象要放在最前面
enum Season01 {

//    public static final Season01 SPRING = new Season01("春天", "温暖");
//    public static final Season01 SUMMER = new Season01("夏天", "炎热");
//    public static final Season01 AUTUMN = new Season01("秋天", "凉爽");
//    public static final Season01 WINTER = new Season01("冬天", "寒冷");
    //如果使用了enum来实现枚举类
    SPRING("春天","温暖"),
    SUMMER("夏天", "炎热"),
    AUTUMN("秋天", "凉爽"),
    WINTER("冬天", "寒冷");


    private String name;
    private String desc;

    private Season01(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return "name=" + this.name + " desc" + this.desc;
    }

}
